<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .clock {
            height: 400px;
            width: 400px;
            border: 10px solid red;
            border-radius: 50%;
            display: flex;
            /* flex主侧轴居中 */
            justify-content: center;
            align-items: center;
        }
        .clock>div {
            font-size: 30px;
            /* 叠放 */
            position: absolute;
        }

    </style>
</head>
<body>
    <div class="clock">
        <!-- 使用js添加元素 -->
    </div>

    <script>
        var clock = document.querySelector('.clock');
        for (var i = 0; i < 12; i++) {
            var el = document.createElement('div');
            // i: 0 >> 1 >> 30
            // i: 1 >> 2 >> 60
            // i: 2 >> 3 >> 90
            var angle = 30 * (i + 1);
            el.setAttribute('style', `transform: rotate(${ angle }deg) translateY(-180px) rotate(-${ angle }deg);`);
            el.innerText = i + 1;
            clock.appendChild(el);
        }
    </script>
</body>
</html>